<%@ page contentType="text/html;charset=UTF-8" language="java"  import="java.util.*" trimDirectiveWhitespaces="true" %>
<%@include file="/WEB-INF/pages/common/taglib.jsp"%>
<!DOCTYPE html>
<html lang="en">
<head>
  <title>提现申请管理</title>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <%@include file="/WEB-INF/pages/common/commonCss.jsp"%>
  <link rel="stylesheet" href="${basePath}/resources/css/uniform.css" />
  <link rel="stylesheet" href="${basePath}/resources/css/select2.css" />
  <link rel="stylesheet" href="${basePath}/resources/css/matrix-style.css" />
  <link rel="stylesheet" href="${basePath}/resources/css/matrix-media.css" />
  <link rel="stylesheet" href="${basePath}/resources/css/admin/list.css" />
</head>

<body>

<!--Header-part-->
<%@include file="/WEB-INF/pages/common/head.jsp"%>


<!--sidebar-menu-->
<%@include file="/WEB-INF/pages/common/left.jsp"%>

<div id="content">
  <div id="content-header">
    <div id="breadcrumb"> <a href="#" title="Go to Home" class="tip-bottom"><i class="icon-home"></i> 首页</a> <a href="#" class="current">提现申请管理</a> </div>
    <%--<h1>提现申请管理</h1>--%>
  </div>

  <div class="container-fluid">

    <hr>
    <div class="row-fluid">
      <div class="span12">


        <div class="widget-box">
          <div class="widget-title"> <span class="icon"><i class="icon-th"></i></span>
            <h5>Data table</h5>
            <a style="float: right;margin-top: 0.2rem" onclick="tzAdmin.search()" class="btn btn-success"><i class="icon-search icon-white"></i></a>

            <label style="float: right;margin-top: 0.2rem">
              <input type="text" id="keywords" aria-controls="DataTables_Table_0" placeholder="输入查询关键字">
            </label>

          </div>
          <div class="widget-content nopadding">
            <table class="table table-bordered data-table">
              <thead>

              <tr>
                <th>主键</th>
                <th>申请人</th>
                <th>申请提现金额</th>
                <th>处理状态</th>
                <th>操作人</th>
                <th>创建时间</th>
                <th>操作</th>
              </tr>
              </thead>
              <tbody id="tbody" data-model="wallet/cashapply">
                  <tr>
                    <td id="loading" colspan="50"></td>
                  </tr>


              </tbody>
               <tfoot>

               </tfoot>
            </table>
            <div class="cpage"></div>


          </div>
        </div>
      </div>
    </div>
  </div>
</div>

   <!--Footer-part-->
<%@include file="/WEB-INF/pages/common/footer.jsp"%>

<!--end-Footer-part-->

<%@include file="/WEB-INF/pages/common/commonJS.jsp"%>
   <script type="text/javascript" src="${basePath}/resources/sg/tz_page.js"></script>
   <script src="${basePath}/resources/js/jquery.ui.custom.js"></script>
<script src="${basePath}/resources/js/bootstrap.min.js"></script>
<script src="${basePath}/resources/js/jquery.uniform.js"></script>
<script src="${basePath}/resources/js/select2.min.js"></script>
<script src="${basePath}/resources/js/jquery.dataTables.min.js"></script>
<script src="${basePath}/resources/js/matrix.js"></script>
<%--<script src="${basePath}/resources/js/matrix.tables.js"></script>--%>

   <script>
       $(function(){
         tzAdmin.loadData(0,10,function(itemCount){
           tzAdmin.initPage(itemCount);//分页加载一次吗
         });
       });


       var cashApply = {
           updateAgree:function(obj){
               $.tzConfirm({title:"友情提示",content:"您确定审核通过吗?",callback:function(ok){
                   if(ok){
                       var $this = $(obj);
                       var opid = $this.data("opid");
                       var frontuserId = $this.data("userid");
                       var money = $this.data("money");
                       clearTimeout(this.timer);
                       var params = {};
                       params["id"] = opid;
                       params["userId"] = frontuserId;
                       params["money"] = money;
                       console.log('params=='+JSON.stringify(params));
                       this.timer = setTimeout(function(){
                           //alert(adminPath+"/"+model+"/delete");
                           loading("请稍后数据执行中...");
                           $.ajax({
                               type:"post",
                               url:adminPath+"/wallet/cashapply/updateAgree",
                               data:params,
                               success:function(data){
                                   if(data){
                                       if(data.res){
                                           if(data.res == 'fail1'){
                                               loading("付款异常",5);
                                           }
                                           if(data.res == 'fail'){
                                               loading("查询异常",5);
                                           }
                                           if(data.res == 'fail'){
                                               loading("网络异常",5);
                                           }
                                          if(data.res == 'success'){
                                              loading("执行成功...",5);
                                          }
                                          if(data.res == 'limit1'){
                                              loading("执行失败,不能低于1元",5);
                                          }
                                          if(data.res == 'once2000'){
                                               loading("执行失败,提现不能超过2000",5);
                                          }
                                          if(data.res == 'overBalance'){
                                               loading("执行失败,改用户余额不足以提现",5);
                                          }
                                       }
                                   }
                                   if(data.paymap && data.paymap.result_code=='FAIL') {
                                       loading("执行失败,错误原因:"+data.paymap.err_code_des,5);
                                   }
                                   tzAdmin.loadData(0,10,function(itemCount){
                                       tzAdmin.initPage(itemCount);//分页加载一次吗
                                   });
                               }
                           });
                       },200);
                   }
               }});
           },
           updateRefuse:function(obj){
                   $.tzConfirm({title:"友情提示",content:"您确定拒绝申请提现吗?",callback:function(ok){
                       if(ok){
                           var $this = $(obj);
                           var opid = $this.data("opid");
                           clearTimeout(this.timer);
                           var params = {};
                           params["id"] = opid;
                           console.log('params=='+JSON.stringify(params));
                           this.timer = setTimeout(function(){
                               //alert(adminPath+"/"+model+"/delete");
                               loading("请稍后数据执行中...");
                               $.ajax({
                                   type:"post",
                                   url:adminPath+"/wallet/cashapply/updateRefuse",
                                   data:params,
                                   success:function(data){
                                       if(data==1){
                                           loading("操作成功...",3);
                                       }else{
                                           loading("操作失败...",3);
                                       }
                                       tzAdmin.loadData(0,10,function(itemCount){
                                           tzAdmin.initPage(itemCount);//分页加载一次吗
                                       });
                                   }
                               });
                           },200);
                       }
                   }});
               },
       };

   </script>

</body>
</html>
